﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace ComposerToolsTest
{
    class Utilities
    {
        /// <summary>
        /// returns a list of n pictures -- it may do a lot of duplicating of those images as there are only a few source images!
        /// </summary>
        /// <param name="number"></param>
        /// <returns></returns>
        public static List<FileInfo> Pictures(int number)
        {
            FileInfo[] sourceFiles = new FileInfo[] {
                new FileInfo("..\\..\\..\\t_DTBuilderLib\\aspectweirdness.jpg"),
                new FileInfo("..\\..\\..\\t_DTBuilderLib\\file1.jpg"),
                new FileInfo("..\\..\\..\\t_DTBuilderLib\\texSmallSlide.jpg")
            };

            var goodfiles = from s in sourceFiles
                            where s.Exists
                            select s;

            List<FileInfo> result = new List<FileInfo>();
            while (result.Count < number)
            {
                foreach (var s in goodfiles)
                {
                    result.Add(s);
                    if (result.Count == number)
                    {
                        return result;
                    }
                }
            }
            return result;
        }
    }
}
